<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main"/>
  <g:javascript library="scriptaculous"/>
  <g:javascript library="prototype"/>
  <title>Event Details</title>
</head>
<body>
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}">Home</a></span>
  <span class="menuButton"><g:link class="create" action="create">New Event</g:link></span>
  <g:if test="${eventInstance.administrator.id == session.user.id}">
    <span class="menuButton"><g:link class="edit" action="edit" params="[id:eventInstance.id]">Edit Event</g:link></span>
  </g:if>
  <g:render template="/common/menubar"/>
</div>
<div class="body">
  <h1>Event Details</h1>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <div class="dialog">
    <table>
      <tbody>
      <tr class="prop">
        <td valign="top" class="name">Name:</td>
        <td valign="top" class="value">${fieldValue(bean: eventInstance, field: 'name')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Description:</td>
        <td valign="top" class="value">${fieldValue(bean: eventInstance, field: 'description')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Location:</td>
        <td valign="top" class="value">${fieldValue(bean: eventInstance, field: 'location')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Start Date:</td>
        <td valign="top" class="value">${fieldValue(bean: eventInstance, field: 'startDate')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">End Date:</td>
        <td valign="top" class="value">${fieldValue(bean: eventInstance, field: 'endDate')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Administrator:</td>
        <td valign="top" class="value"><g:link controller="userAccount" action="show" id="${eventInstance?.administrator?.id}">${eventInstance?.administrator?.encodeAsHTML()}</g:link></td>
      </tr>
      </tbody>
    </table>
  </div>

  <h1>Positions</h1>
  <div id="confirmationMessage">
  </div>
  <div class="list" id="positionList">
    <g:render template="positionList"/>
  </div>
  <g:javascript>
        new Ajax.PeriodicalUpdater('positionList', '<g:createLink action="positionList" id="${eventInstance.id}"/>', {frequency: 3, maxFrequency: 60, decay: 2});
  </g:javascript>
</div>
%{--<div class="paginateButtons">--}%
%{--<g:paginate total="${eventInstance.positions.count}" />--}%
%{--</div>--}%
</div>

</body>
</html>
